from django.conf.urls import patterns, include, url
from django.contrib import admin

import app_info
import settings
from core.admin_site import CustomAdminSite
from accounts import views

admin.site = CustomAdminSite()
admin.site.login = views.login
# Uncomment the next two lines to enable the admin:
#from app_info import admin
admin.autodiscover()

urlpatterns = patterns('',
    # Examples:
    #url(r'^$', 'app_info.views.landing', name='index'),
    url(r'^$', 'production_kanban.views.simple_login'),
    
    url(r'^search/$', 'app_info.views.search_for_info', name='search'),
    url(r'^get_prefix/$', 'app_info.views.get_bundle_id_prefix', name='get_prefix'),
    url(r'^get_studios/$', 'app_info.views.get_available_studios', name='get_studios'),
    url(r'^get_format/$', 'app_info.views.get_code_format', name='get_format'),
    url(r'^import_apps/$', 'app_info.views.import_old_apps', name='import_apps'),
    url(r'^export_apps/$', 'app_info.views.export_apps', name='export_apps'),
    url(r'^export_version/$', 'app_info.views.export_version', name='export_version'),
    url(r'^get_username/$', 'app_info.views.get_current_user', name='get_username'),
    url(r'^get_included_studios/$', 'app_info.views.get_included_studios', name='get_included_studios'),
    url(r'^get_company/$', 'app_info.views.get_company', name='get_company'),

    url(r'^report_center/production_output/$', 'app_info.views.get_production_output', name='get_production_output'),
    url(r'^report_center/qa_kanban_board/$', 'qa_info.views.get_qa_kanban', name='get_qa_kanban'),
    url(r'^report_center/weekly_report/$', 'notification.views.weekly_report'),

    url(r'^get_app_name/$', 'ads_info.views.get_app_name', name='get_app_name'),
    url(r'^adsactivate/getapps$', 'ads_info.views.get_ads', name='get_ads_apps'),
    url(r'^adsactivate/feedback$', 'ads_info.views.activate_ads', name='activate_ads'),
    url(r'^adscheck/result$', 'ads_info.views.check_ads', name='check_ads'),

    url(r'^get_iap_type/$', 'iap_info.views.get_iap_type', name='get_iap_type'),

    url(r'^get_rating/$', 'sub_info.views.get_rating', name='get_rating'),
    url(r'^get_version/$', 'sub_info.views.get_version_log', name='get_version'),
    url(r'^get_type/$', 'sub_info.views.get_log_type', name='get_type'),
    url(r'^get_sub/$', 'sub_info.views.get_sub_info', name='get_sub'),
    url(r'^get_rej/$', 'sub_info.views.get_rej', name='get_rej'),
    url(r'^go_ps/$', 'sub_info.views.go_ps', name='go_ps'),

    url(r'^filter_clouds/$', 'prd_order.views.filter_studio_clouds', name='filter_clouds'),
    url(r'^filter_studios/$', 'prd_order.views.filter_studios', name='filter_studios'),
    url(r'^filter_team/$', 'prd_order.views.filter_team', name='filter_team'),
    url(r'^filter_pjms/$', 'prd_order.views.filter_pjms', name='filter_pjms'),
    url(r'^filter_pjm_studio/$', 'prd_order.views.filter_pjm_studio', name='filter_pjm_studio'),
    url(r'^filter_tasks/$', 'prd_order.views.filter_tasks', name='filter_tasks'),

    url(r'^get_unread_notices/$', 'notification.views.get_unread_notices', name='get_unread_notices'),

    url(r'^api/', include('api.urls')),
#    url(r'^get_fullfilled/$', 'sub_info.views.get_request_fullfilled', name='get_fullfilled'),
    # url(r'^app_submission/', include('app_submission.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
    url(r'^accounts/', include('accounts.urls')),

    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(app_info.admin.admin.site.urls)),
    
    url(r'^production_kanban/$','production_kanban.views.production_kanban'),
    url(r'^production_kanban/ajax/$','production_kanban.views.ajax_view')

)

if settings.DEBUG:
    urlpatterns += patterns("",
        url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
            {'document_root': settings.MEDIA_ROOT}
        ),
        url(r'^exported_apps/(?P<path>.*)$', 'django.views.static.serve',
            {'document_root': settings.EXPORTED_APPS_DIR}
        ),
    )